program main
use madx_keywords
real(dp) a(3),e(3,3),B(3,3)
real(dp) ap(3),ep(3,3)
real(dp) alpha(3) 


!  In PTC tracking routines, the translations and rotations used to patch from one
!fibre to the next obviously operate on rays

!GEO_ROT(ENT,EXI,A,B,ANG,optional:BASIS)

a=(/1.0_dp,1.0_dp,0.0_dp/)
E=global_frame   ! a,ent form an affine basis located at the origin
B(2,:)=E(1,:)
B(1,:)=-E(2,:)
B(3,:)=-E(3,:)
alpha=(/ pi/2.0_dp , pi/2.0_dp , pi/2.0_dp /)


CALL GEO_ROT(E,EP,A,AP,ALPHA,BASIS=B)

WRITE(6,*) " NEW POSITION "
WRITE(6,*) AP
WRITE(6,*) " NEW VECTORS "
WRITE(6,*) EP(1,:)
WRITE(6,*) EP(2,:)
WRITE(6,*) EP(3,:)



end program main
